package com.zjj.disk.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zjj.disk.controller.result.Result;
import com.zjj.disk.pojo.BookKeeping;
import com.zjj.disk.pojo.BookKeepingDTO;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

public interface BookKeepingService extends IService<BookKeeping> {

    /**
     * 分页查询
     *
     * @param queryDto    dto
     * @param currentPage 当前页
     * @param pageSize    页大小
     * @return
     */
    IPage<BookKeepingDTO> getBookKeepingByConditions(BookKeepingDTO queryDto, int currentPage, int pageSize);

    /**
     * 新增记账记录
     *
     * @param bookKeepingDTO dto
     * @return
     */
    boolean addBookKeeping(BookKeepingDTO bookKeepingDTO);

    /**
     * @return 获取本年度最高金额 amount
     */
    BookKeeping getMaxAmountForCurrentYear();

    /**
     * @return 获取历史最高金额 amount
     */
    BookKeeping getMaxAmountHistorical();

    /**
     * @return 获取 project='支出'/'收入' 的最高金额 amount
     */
    BookKeeping getMaxAmountForExpense(String projectName);

    /**
     * @return 获取明细
     */
    Result detailedBooks();

    /**
     * @param userName
     * @return 生成账单
     */
    Map<String, Object> getCurrentMonthSummary(String userName, String yearMonth);

    List<BookKeeping> importFromExcel(MultipartFile file);

    /**
     * 根据 ID 列表批量删除
     *
     * @param ids ID 列表
     * @return 影响的行数
     */
    int deleteByIds(List<Integer> ids);
}
